package com.guqj.pattern.factory.abstr;


public class FruitsFactory {

	public static FruitsApple acquireApple(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException{
		if(className == null || "".equals(className.trim())){
			return null;
		}
		return (FruitsApple) Class.forName(className).newInstance();
	}
	
	public static FruitsBanana acquireBanana(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException{
		if(className == null || "".equals(className.trim())){
			return null;
		}
		return (FruitsBanana) Class.forName(className).newInstance();
	}
	
	public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
		FruitsApple apple = FruitsFactory.acquireApple("com.rabbitmq.pattern.factory.abstr.Apple");
		apple.describe();
	}
}
